package com.sky.city.widget;

import android.content.Context;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.AttributeSet;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;

public class CustomBoldLineFontTextView extends AppCompatTextView {

    public CustomBoldLineFontTextView(@NonNull Context context) {
        super(context);
        init();
    }

    public CustomBoldLineFontTextView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public CustomBoldLineFontTextView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    public void init(){
        Typeface typeface = Typeface.createFromAsset(getContext().getAssets(), "timesnewroman.ttf");
        setTypeface(typeface);

        Paint paint = getPaint();
        paint.setFlags(Paint.UNDERLINE_TEXT_FLAG); // 设置下划线
    }
}
